package com.project.web.controller.user;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.project.user.domain.UserBrowseRecord;
import com.project.user.service.IUserBrowseRecordService;
import com.project.web.controller.common.BaseController;
import com.project.common.base.TableDataInfo;
import com.project.common.base.AjaxResult;

/**
 * 浏览记录 信息操作处理
 *
 * @author administrator
 */
@Controller
@RequestMapping("/user/userBrowseRecord")
public class UserBrowseRecordController extends BaseController {

    @Autowired
    private IUserBrowseRecordService userBrowseRecordService;

    /**
     * 查询浏览记录
     *
     * @param browseRecord
     * @return
     */
    @PostMapping()
    @ResponseBody
    public TableDataInfo userBrowseRecord(UserBrowseRecord browseRecord) {
        browseRecord.setUserId(this.getUserId());
        startPage();
        return getDataTable(userBrowseRecordService.selectUserBrowseRecordList(browseRecord));
    }

    /**
     * 删除浏览记录
     *
     * @param browseRecord
     * @return
     */
    @PostMapping("/delete")
    @ResponseBody
    public AjaxResult delete(UserBrowseRecord browseRecord) {
        browseRecord.setUserId(this.getUserId());
        return toAjax(userBrowseRecordService.deleteUserBrowseRecord(browseRecord));
    }

}
